package com.njlime.cms.repository.app;

import com.njlime.cms.entities.CommunityUp;
import com.njlime.core.base.repository.impl.BaseDaoImpl;
import org.springframework.stereotype.Repository;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by Dean on 2017/10/10.
 */
@Repository
public class AppCommunityUpDaoImpl extends BaseDaoImpl<CommunityUp> {
    /**
     * 获取点赞个数
     */
    public int upCount(Integer community_id,Integer user_id){
        StringBuilder sb = new StringBuilder();
        List<Object> arrList = new ArrayList<Object>();
        sb.append(" SELECT * FROM t_community_up ti WHERE ti.community_id = ? ");
        arrList.add(community_id);
        if(user_id != null){
            sb.append("and ti.up_user_id = ? ");
            arrList.add(user_id);
        }
        int resCount = getListJdbcSize(sb.toString(), arrList);
        return resCount;

    }
}
